/**
    @file liveness.h 
    @brief routine used to generate a liveness graph
 */

#ifndef __LIVENESS_H__
#define __LIVENESS_H__
#include "graph.h"
#include "temp.h"
#include "table.h"

typedef struct COL_moveList_ *Live_moveList; ///< the Live_moveList type
struct COL_moveList_
{
    G_node src, dst;
    Live_moveList next;
};
Live_moveList Live_MoveList(G_node src, G_node dst, Live_moveList next);

///The conflict graph structure
struct COL_conflictGraph
{
    G_graph graph;          ///<The conflict graph
    Live_moveList moves;    ///<List of all the MOVE instructions
};

///The liveness graph structure
struct Live_graph
{
    G_nodeList nodes;       ///<The nodes in the graph
    TAB_table node_set;     ///<A table used to lookup U_set for a given node
};

///Get the temp for a given node
Temp_temp Live_gtemp(G_node n);

typedef struct inout_
{
    U_set in;
    U_set out;
} *inout;

/**
    Generate the liveness map
    @param flow The flow graph returned by flowgraph routine
    @return a liveness graph
*/
struct Live_graph Live_liveness(G_graph flow);


/**Get the G_node of a given temp*/
G_node Live_tempToGnode(Temp_temp temp);

#endif

